-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: resolve task persistence issue for Desktop directory on macOS #8473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add arePathsEqual utility function for proper path comparison - Update useTaskSearch hook to use arePathsEqual for workspace filtering - Add comprehensive tests for Desktop directory path handling - Fix path normalization to handle mixed separators and edge cases This ensures tasks are properly filtered and persist when switching panels, especially when the workspace is the Desktop directory. Fixes #8471
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review protocol engaged: the code stares back and I report anomalies with machine-like indifference.
| let normalized = p.replace(/\\/g, "/") | ||
|
|
||
| // Remove duplicate slashes | ||
| normalized = normalized.replace(/\/+/g, "/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: UNC paths lose their double-leading-slash prefix. Collapsing duplicate slashes and only keeping a single leading empty segment transforms //server/share into /server/share, changing semantics on Windows network paths. Consider preserving the UNC prefix when the original input matches ^[\/]{2}[^\\/]. Add normalization that retains the double slash at the start for UNC paths and include tests for //server/share variants.
| path2 = normalizePath(path2) | ||
|
|
||
| // Windows paths are case-insensitive | ||
| if (process.platform === "win32") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Case sensitivity on macOS. arePathsEqual is case-sensitive for darwin, but the default macOS filesystem is case-insensitive. This can cause false negatives if casing differs (e.g., /Users/User/Desktop vs /users/user/Desktop). Consider treating darwin as case-insensitive by default or make this behavior configurable/detectable at runtime; add tests covering darwin case variations.
Summary
This PR fixes issue #8471 where tasks would disappear when switching panels in the VSCode extension, specifically when the workspace is the Desktop directory on macOS.
Problem
When users had VSCode open without a workspace (defaulting to Desktop directory), tasks would disappear from the task panel when navigating to other panels (like settings) and then returning to the task panel. This was specific to the Desktop directory - other directories worked correctly.
Root Cause
The issue was caused by inconsistent path comparison in the
useTaskSearchhook. When filtering tasks by workspace, simple string equality was used, which failed to handle:Solution
Created
arePathsEqual()utility function - A robust cross-platform path comparison function that:Updated
useTaskSearchhook - Modified the workspace filtering logic to usearePathsEqual()instead of simple string comparisonAdded comprehensive tests - Created test suites for both the utility function and the specific Desktop directory scenarios
Testing
Changes
webview-ui/src/utils/path.ts- Path comparison utilitywebview-ui/src/components/history/useTaskSearch.ts- Use proper path comparisonwebview-ui/src/utils/__tests__/path.spec.ts- Path utility testswebview-ui/src/components/history/__tests__/useTaskSearch.spec.tsx- Desktop directory testsFixes #8471
Important
Fixes task persistence issue in VSCode extension for Desktop directory on macOS by using a new path comparison utility.
useTaskSearchto usearePathsEqual()for path comparison, ensuring consistent task filtering.arePathsEqual()inpath.tsfor robust cross-platform path comparison.arePathsEqual()inpath.spec.ts.useTaskSearch.spec.tsx.This description was created by
for b4659fb. You can customize this summary. It will automatically update as commits are pushed.